{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "f278d35f",
   "metadata": {},
   "source": [
    "---\n",
    "* 记录人：lz  \n",
    "* 时间：2021-11-29  \n",
    "* week14 : 函数和模块   \n",
    "* 学习线上资源：<https://www.cnblogs.com/xuzhichao/p/11570285.html> & <https://docs.python.org/3/tutorial/controlflow.html#defining-functions>\n",
    "---"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2e4efda8",
   "metadata": {},
   "source": [
    "## 本周学习\n",
    "> 1. 函数的定义  \n",
    "> 2. 函数的使用  \n",
    "> 3. 函数的参数  "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "16204c9e",
   "metadata": {},
   "source": [
    "### 函数的定义\n",
    "* 定义一个函数的一般步骤"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "7171172f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0 1 1 2 3 5 8 \n"
     ]
    }
   ],
   "source": [
    "a, b = 0, 1\n",
    "while a < 10:\n",
    "     print(a, end=' ')\n",
    "     a, b = b, a+b\n",
    "print()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "0ac647aa",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0 1 1 2 3 5 8 13 21 34 55 89 \n"
     ]
    }
   ],
   "source": [
    "a, b = 0, 1\n",
    "while a < 100:\n",
    "     print(a, end=' ')\n",
    "     a, b = b, a+b\n",
    "print()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "4dabbaaf",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 \n"
     ]
    }
   ],
   "source": [
    "a, b = 0, 1\n",
    "while a < 1000:\n",
    "     print(a, end=' ')\n",
    "     a, b = b, a+b\n",
    "print()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "eb95e8c7",
   "metadata": {},
   "outputs": [],
   "source": [
    "# ......  想重复使用某一个功能（避免重复造轮子）\n",
    "#         使用的人可以不懂代码，只要会调用函数即可  function_name()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c6f8504c",
   "metadata": {},
   "source": [
    "> 1. 定义函数的一般方法：\n",
    "```\n",
    "def function_name():   # 1. function_name 遵循变量定义的规则  区别于数学==》 f(x) python 的函数可以自定义名称  \n",
    "    \"\"\"函数的注释\"\"\"  # 2.函数的注释可以和使用者交流\n",
    "    函数体         # 3. 函数体与要和定义函数保持一定的tab缩进\n",
    "    \n",
    "function_name()       # 4.调用函数\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "86a7480c",
   "metadata": {},
   "outputs": [],
   "source": [
    "def fib(n):    # write Fibonacci series up to n\n",
    "    \"\"\"Print a Fibonacci series up to n.\"\"\"\n",
    "    a, b = 0, 1\n",
    "    while a < n:\n",
    "        print(a, end=' ')\n",
    "        a, b = b, a+b\n",
    "    print() \n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "4d245e19",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0 1 1 2 3 5 8 \n"
     ]
    }
   ],
   "source": [
    "fib(10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "cc874403",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0 1 1 2 3 5 8 13 21 34 \n"
     ]
    }
   ],
   "source": [
    "fib(50)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "dba1ec15",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hello world\n"
     ]
    }
   ],
   "source": [
    "def hello():\n",
    "    \"\"\"打印你好，世界\"\"\"\n",
    "    print(\"hello world\")\n",
    "hello()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "712ef952",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hello:Cc同学\n"
     ]
    }
   ],
   "source": [
    "def hello_user(username):\n",
    "    \"\"\"打印，你好，xx同学\"\"\"\n",
    "    print(\"hello:\" + username.title() + '同学')\n",
    "    \n",
    "hello_user(\"cc\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "becef961",
   "metadata": {},
   "source": [
    "**注意**  \n",
    "* 在第一行定义函数中，不需要任何信息就能完成工作，因此括号是空的（即便如此，括号必不可少！）  \n",
    "* 要调用函数，可以依次指定函数名以及括号括起的必要信息。在第五行代码中，因为此函数greet_uesr()括号中不需要任何信息，只需要输入greet_uesr（）即可。和预期效果一样，打印Hello，world\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6d8f168d",
   "metadata": {},
   "source": [
    "### 函数的参数  \n",
    "\n",
    "> 1. 形式参数： \n",
    ">> A定义函数时，写在function_name 括号里面的参数   \n",
    ">> B在定义函数时 形式参数不占用空间  \n",
    "> 2. 实际参数：\n",
    ">> A 调用函数时，写在function_name 括号里面的参数  \n",
    ">> B 在使用函数时，形式蚕食被分配空间，变为实际参数  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "4c3e8332",
   "metadata": {},
   "outputs": [],
   "source": [
    "def describe_pet(animal_type,pet_name):      # animal_type  pet_name 是形式参数\n",
    "    \"\"\"显示宠物信息\"\"\"\n",
    "    print(\"\\nI have a\" + animal_type + \".\")\n",
    "    print(\"My\" + animal_type + \"'s name is \"+pet_name.title() + \".\")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "1be1cf6b",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "I have adog.\n",
      "Mydog's name is Cc.\n"
     ]
    }
   ],
   "source": [
    "describe_pet('dog','cc')  # dog ,cc 是实际参数"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c4cd8469",
   "metadata": {},
   "source": [
    "* 当函数具有多个参数时：\n",
    "\n",
    "> 1.位置参数  \n",
    ">> 1. 形式参数有先后顺序，函数调用的过程中应考虑的先后顺序，避免出现顺序错误  \n",
    ">> 2. 调用函数的过程中要考虑形式参数的个数 \n",
    "\n",
    "> 2.关键字参数  \n",
    ">> 1.调用函数时，通过赋值的方式传递给定义好的形参变量数据  \n",
    ">> 2.关键字参数不考虑先后顺序，因为是指定变量赋值  \n",
    "\n",
    "> 3.默认参数  \n",
    ">> 1.在形式参数中，提前预先设置一个用户可能使用的参数  \n",
    ">> 2.用户在使用/调用函数时，可以省略不给默认参数赋值  \n",
    ">> 3.用户默认参数赋值，将替换默认参数的值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "40bd713f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "I have a dog.\n",
      "Mydog's name is Cc.\n"
     ]
    }
   ],
   "source": [
    "def describe_pet(animal_type,pet_name):      # animal_type  pet_name 是形式参数\n",
    "    \"\"\"显示宠物信息\"\"\"\n",
    "    print(\"\\nI have a \" + animal_type + \".\")\n",
    "    print(\"My\" + animal_type + \"'s name is \"+pet_name.title() + \".\")\n",
    "    \n",
    "describe_pet('dog','cc')  # dog ,cc 是实际参数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "1f61268e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "I have a dog.\n",
      "Mydog's name is Cc.\n"
     ]
    }
   ],
   "source": [
    "# 位置参数\n",
    "# 在使用 describe_pet() 函数时 需要考虑 参数的位置，从而进行参数数据的输入（实参的调用）\n",
    "\n",
    "describe_pet('dog','cc')  # 实参要根据 形式参数的位置的先后顺序 先写 animal_type, 再写pet_name"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "c730e422",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "I have a cc.\n",
      "Mycc's name is Dog.\n"
     ]
    }
   ],
   "source": [
    "describe_pet('cc','dog')  # 切记不可随意调换位置参数的先后顺序"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "b560ebf1",
   "metadata": {},
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "describe_pet() missing 1 required positional argument: 'pet_name'",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-27-f6a386e95c13>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mdescribe_pet\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'dog'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m: describe_pet() missing 1 required positional argument: 'pet_name'"
     ]
    }
   ],
   "source": [
    "describe_pet('dog')   # 如果缺少任意一个位置参数 都会报错"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "25a5b197",
   "metadata": {},
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "describe_pet() missing 2 required positional arguments: 'animal_type' and 'pet_name'",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-19-f95e5f55e3d1>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mdescribe_pet\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m: describe_pet() missing 2 required positional arguments: 'animal_type' and 'pet_name'"
     ]
    }
   ],
   "source": [
    "describe_pet()   #  不能缺少位置参数 否则会报错"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "07e200a6",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "I have adog.\n",
      "Mydog's name is Cc.\n"
     ]
    }
   ],
   "source": [
    "# 关键字参数使用\n",
    "\n",
    "describe_pet(pet_name='cc',animal_type='dog')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "c4b23f45",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "I have adog.\n",
      "Mydog's name is Doudou.\n"
     ]
    }
   ],
   "source": [
    "# 默认参数\n",
    "\n",
    "def describe_pet(pet_name,animal_type='dog'):      # animal_type  pet_name 是形式参数\n",
    "    \"\"\"\n",
    "    显示宠物信息\n",
    "        通过打印的方式显示宠物类型和宠物名称\n",
    "    参数信息：\n",
    "        pet_name： 是一个字符串，宠物名称\n",
    "        animal_type：是一个字符串，宠物类型\n",
    "    \n",
    "    \"\"\"\n",
    "    print(\"\\nI have a\" + animal_type + \".\")\n",
    "    print(\"My\" + animal_type + \"'s name is \"+pet_name.title() + \".\")\n",
    "describe_pet(\"doudou\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "50c65b6a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on function describe_pet in module __main__:\n",
      "\n",
      "describe_pet(pet_name, animal_type='dog')\n",
      "    显示宠物信息\n",
      "        通过打印的方式显示宠物类型和宠物名称\n",
      "    参数信息：\n",
      "        pet_name： 是一个字符串，宠物名称\n",
      "        animal_type：是一个字符串，宠物类型\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(describe_pet)   # 用help可以帮助不懂函数的人快速了解 这个函数的作用  所以要在注释中写好解释"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "e5f247e6",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on built-in function print in module builtins:\n",
      "\n",
      "print(...)\n",
      "    print(value, ..., sep=' ', end='\\n', file=sys.stdout, flush=False)\n",
      "    \n",
      "    Prints the values to a stream, or to sys.stdout by default.\n",
      "    Optional keyword arguments:\n",
      "    file:  a file-like object (stream); defaults to the current sys.stdout.\n",
      "    sep:   string inserted between values, default a space.\n",
      "    end:   string appended after the last value, default a newline.\n",
      "    flush: whether to forcibly flush the stream.\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(print)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "d9905885",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hello   hello"
     ]
    }
   ],
   "source": [
    "print('hello','hello',end=\"\",sep=\"   \")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "acae709a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hello \n",
      " hello\n"
     ]
    }
   ],
   "source": [
    "print('hello','\\n','hello',sep=\" \")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7b131718",
   "metadata": {},
   "source": [
    "---\n",
    "> 1.关键字参数 和位置参数可以一起使用吗？  \n",
    ">> 1. positional argument follows keyword argument(位置参数<font style=\"color:red\">均</font>要放在关键字参数的前面)  \n",
    ">> 2. test1() got multiple values for argument 'x'(映射，不能出现，重复值) \n",
    "\n",
    "> 2.定义函数：默认参数（定义函数）和非默认参数（定义函数）的先后关系  \n",
    ">> 1.  non-default argument follows default argument (非默认参数<font style=\"color:red\">均</font>要放在默认参数的前面)  \n",
    "\n",
    "---\n",
    "* 以下为测试代码："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "68702177",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 案例1\n",
    "def test1(x,y,z):\n",
    "    \"\"\"打印x,y,z的值\"\"\"\n",
    "    print(x)\n",
    "    print(y)\n",
    "    print(z)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "0b3aa2e6",
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "positional argument follows keyword argument (<ipython-input-35-98a57d0c021e>, line 1)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  File \u001b[1;32m\"<ipython-input-35-98a57d0c021e>\"\u001b[1;36m, line \u001b[1;32m1\u001b[0m\n\u001b[1;33m    test1(x=1,2,z=3)\u001b[0m\n\u001b[1;37m              ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m positional argument follows keyword argument\n"
     ]
    }
   ],
   "source": [
    "test1(x=1,2,z=3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "5db24c1c",
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "positional argument follows keyword argument (<ipython-input-36-7b072ba57ba6>, line 1)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  File \u001b[1;32m\"<ipython-input-36-7b072ba57ba6>\"\u001b[1;36m, line \u001b[1;32m1\u001b[0m\n\u001b[1;33m    test1(1,y=2,3)\u001b[0m\n\u001b[1;37m                ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m positional argument follows keyword argument\n"
     ]
    }
   ],
   "source": [
    "test1(1,y=2,3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "183213ca",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1\n",
      "2\n",
      "3\n"
     ]
    }
   ],
   "source": [
    "test1(1,y=2,z=3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "8f903646",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1\n",
      "2\n",
      "3\n"
     ]
    }
   ],
   "source": [
    "test1(1,z=3,y=2)   # 关键字参数全都放在位置参数的后面，可以改变任意关键字参数的位置，但决不可以放到位置参数的前面"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "a502e869",
   "metadata": {},
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "test1() got multiple values for argument 'x'",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-39-fb2f234601ba>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mtest1\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mx\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m2\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0my\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m3\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m: test1() got multiple values for argument 'x'"
     ]
    }
   ],
   "source": [
    "test1(1,x=2,y=3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "50c4305f",
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "non-default argument follows default argument (<ipython-input-40-5a62f6077d84>, line 2)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  File \u001b[1;32m\"<ipython-input-40-5a62f6077d84>\"\u001b[1;36m, line \u001b[1;32m2\u001b[0m\n\u001b[1;33m    def test1(x,y=2,z):\u001b[0m\n\u001b[1;37m              ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m non-default argument follows default argument\n"
     ]
    }
   ],
   "source": [
    "# 案例2\n",
    "def test1(x,y=2,z):\n",
    "    \"\"\"打印x,y,z的值\"\"\"\n",
    "    print(x)\n",
    "    print(y)\n",
    "    print(z)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "7d1c3c62",
   "metadata": {},
   "outputs": [],
   "source": [
    "def test1(x,z,y=3):     # x,z 是非默认参数,y=3是默认参数\n",
    "    \"\"\"打印x,y,z的值\"\"\"\n",
    "    print(x)\n",
    "    print(y)\n",
    "    print(z)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "2474a430",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1\n",
      "3\n",
      "2\n"
     ]
    }
   ],
   "source": [
    "test1(1,2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "b00ab14d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1\n",
      "2\n",
      "4\n"
     ]
    }
   ],
   "source": [
    "test1(1,y=2,z=4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "f11d0ba7",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1\n",
      "3\n",
      "2\n"
     ]
    }
   ],
   "source": [
    "test1(z=2,x=1)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "507ae0e1",
   "metadata": {},
   "source": [
    "### 课本练习实践"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "id": "4a8276b0",
   "metadata": {},
   "outputs": [],
   "source": [
    "def searchavowels(word):\n",
    "    \"\"\"判断输入文本出现的元音字母有哪些\"\"\"\n",
    "    vowels = set('aeiou')\n",
    "    word = set(word)\n",
    "    print(vowels & word)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "id": "a48f3cf1",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'o', 'i', 'e', 'a'}\n"
     ]
    }
   ],
   "source": [
    "searchavowels(\"my name is dodo\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2ea757dc",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
